#include <stdio.h>

void copy(FILE * s, FILE * d)
{
    char ch;
    while ((ch = fgetc(s)) != EOF) {
        fputc(ch, d);
    }
}

int main(int argc, char **argv)
{
    FILE * fp;

    if (argc < 2) {
        copy(stdin, stdout);

    } else {
        while (--argc) {

            if ((fp = fopen(*++argv, "r")) == NULL) {
                fprintf(stderr, "文件%s无法正确打开.\n", *argv);
                return 1;

            } else {
                copy(fp, stdout);
            }
        }
    }

    return 0;
}

